package Demo5;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86136
 * Date: 2024-05-26
 * Time: 21:22
 */

class A {
    public void fuc() {
        System.out.println("class A :: fuc()");
    }
}
interface IA {
    void testMethod();
}

public class Test {

    public static void main(String[] args) {

        //匿名内部类
        new A(){
           /* @Override
            public void fuc() {
                super.fuc();
            }*/
        }.fuc();

        new A() {
            @Override
            public void fuc() {
                System.out.println("new fuc()");
            }
        }.fuc();

        //这个类实现了IA接口 并重写了testMethod方法
        IA a = new IA() {
            @Override
            public void testMethod() {
                System.out.println("testMethod()...");
            }
        };
        a.testMethod();
    }

    public static void main1(String[] args) {
        //实例化一个实例化内部类对象
        OutClass outClass = new OutClass();
        OutClass.InnerClass innerClass = outClass.new InnerClass();
        innerClass.test();

        //实例化一个静态内部类对象
        OutClass1.InnerClass1 innerClass1 = new OutClass1.InnerClass1();
        innerClass1.test1();


        Test1 test1 = new Test1();
        test1.method();


    }
}
